<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>美丽说登录</title>
    <style>
        .main {
            width: 100%;
            margin: 0 auto;
        }

        .main_img {
            margin-left: 360px;
        }

        .content {
            width: 564px;
            height: 564px;
            margin: 0 auto;
        }

        .register_left {
            width: 590px;
            padding-left: 55px;
            height: 574px;
            float: left;
        }

        form {
            width: 578px;
        }

        fieldset {
            border: none;
            padding: 0;
            margin-top: 16px;
            overflow: hidden;
            line-height: 30px;
            clear: both;
        }


        fieldset .tit {
            width: 83px;
            float: left;
            text-align: right;
            color: #333;
            font-size: 14px;
            display: block;
        }

        fieldset .text {
            border: 1px solid #CFCFCF;
            float: left;
            width: 254px;
            height: 30px;
            margin-left: 5px;
            line-height: 30px;
            background: none;
            border-radius: 3px;
        }

        fieldset .spanspan {
            font-size: 12px;
            color: #999;
            width: 198px;
            float: left;
            height: 30px;
            line-height: 30px;
            margin: 0;
        }

        fieldset .button {
            width: 131px;
            height: 35px;
            margin-left: 90px;
            background: yellowgreen;
            border: none;
            color: white;
        }
    </style>
    <script src="./js/jquery-1.11.0.js"></script>
</head>

<body>
    <div class="main">
        <div class="main_img">
            <a href="./index.html">
                <img src="http://www.nrgou.com/App/Tpl/Home/nrgou/Public/img/logo.png" alt="">
            </a>
        </div>

        <div class="content">
            <div class="register_left">
                <h1>用户登录</h1>
                <form action="./server/goods_login.php" method="post">

                    <fieldset class="ipt_name">
                        <label class="tit" for="">用户名:</label>
                        <input type="text" class="text" placeholder="用户名">
                        <span class="spanspan"></span>
                    </fieldset>

                    <fieldset class="ipt_password">
                        <label class="tit" for="">密码:</label>
                        <input type="password" class="text" placeholder="密码">
                        <span class="spanspan"></span>
                    </fieldset>

                    <fieldset class="ipt_check">
                        <label class="tit" for="">验证码:</label>
                        <input type="text" class="text" placeholder="验证码"><a id="sc"></a><br>
                        <span class="spanspan"></span>
                    </fieldset>

                    <fieldset class="ipt_btn">
                        <input id="loginBtn" type="button" class="button" value="登录">
                    </fieldset>
                </form>
            </div>
        </div>

    </div>


    <script>
        $( function(){
            $("#loginBtn").click( function(){
                $.get("http://jx.xuzhixiang.top/ap/api/login.php",{
                    username: $("input").eq(0).val(),
                    password: $("input").eq(1).val()
                }).then(data=>{
                    // console.log(data);  //智哥的小跟班  111111  id:33191
                                //token:"59e9c037c9585d42a081b049c43353f5"

                    if( data.code == 1 ){
                        localStorage.setItem( "uid" , data.data.id );
                        location.href = "index.html";
                    } else {
                        alert( "用户名或者密码错误，请重试！");
                    }
                });
            });
        });
    </script>

</body>

</html>